package com.jdd.common.util;

import java.util.Locale;

/**
 * @author pengbaoning
 * @version 1.0
 * @description:  工具类
 * @date 2021/3/31 9:39
 */
public class ByteUtils {

    private final static char[] mChars = "0123456789ABCDEF".toCharArray();
    /**
     * byte转换成十六进制字符串
     *
     * @param b byt
     * @return String 每个Byte值之间空格分隔
     */
    public static String bytes2HexStr(byte b) {
        StringBuilder sb = new StringBuilder();
        sb.append(mChars[(b & 0xFF) >> 4]);
        sb.append(mChars[b & 0x0F]);
        return sb.toString().trim().toUpperCase(Locale.US);
    }


}
